#pragma once

#include "D3DRemoteProcessCaptor.h"

class CD3DCaptor
{
	friend class CD3DRemoteProcessCaptor;
	CD3DRemoteProcessCaptor* m_pRpCaptor;
	HCAPTOR m_hRemoteCaptor;
	HANDLE m_hMutex;
	HANDLE m_hFileMapping;
	FMH_Capture* m_pCaptorMapping;
	RPB_CreateCaptor m_RemoteCaptorParam;

	CD3DCaptor(CD3DRemoteProcessCaptor* pRpCaptor) : m_pRpCaptor(pRpCaptor), 
		m_hRemoteCaptor(NULL), m_hMutex(NULL), 
		m_hFileMapping(NULL), m_pCaptorMapping(NULL)
	{
		ZeroMemory(&m_RemoteCaptorParam, sizeof(RPB_CreateCaptor));
	}

	~CD3DCaptor()
	{
		Destroy();
	}
public:
	BOOL Create(LPCSTR szDevcieName);
	void Destroy();
	BOOL GetChange(D3DFORMAT* pd3dfmt, DWORD* pdwWidth, DWORD* pdwHeight, INT* piPitch, void** ppvBits, RGNDATA** pprd);
	void CleanChange();
};